<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('来电记录草稿列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            流水号：<input type="text" name="wsCode"/>
                        </li>
                        <li>
                            来电号码：<input type="text" name="fromTelA"/>
                        </li>
                        <li>
                            来电人：<input type="text" name="fromName"/>
                        </li>
                        <li>
                            地区名称：<input type="text" name="fmAreaName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">
            <a class="btn btn-primary single disabled" onclick="$.operate.editTab()"
               shiro:hasPermission="mTelRcd:processEdit:view">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="mTelRcd:remove:view">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('mTelRcd:processEdit:view')}]];
    var removeFlag = [[${@permission.hasPermi('mTelRcd:remove:view')}]];
    var datas = [[${@dict.getType('sys_normal_disable')}]];
    var prefix = ctx + "system/mTelRcd";

    $(function () {
        var options = {
            url: prefix + "/listMyOver",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/processEdit/{id}",
            removeUrl: prefix + "/remove",
            sortName: "pkId",
            sortOrder: "desc",
            uniqueId: "pkId",
            modalName: "我办结的来电",
            columns: [{
                checkbox: true
            },
                // {field:'ck',checkbox:true,title:'&nbsp;'},
                {
                    field: 'wsCode', title: '流水号', align: 'left', halign: 'center', sortable: true
                    /*,formatter:function(value,row,index){return fmtScanByNO(value,row,index);}*/
                },
                {field: 'liftTelNo', title: '分机号', align: 'center', halign: 'center'},
                {field: 'liftWorker', title: '接听人', align: 'center'},
                {field: 'fmAreaName', title: '地区', align: 'center', sortable: true},
                {field: 'fromTelA', title: '来电号码', align: 'left', halign: 'center', sortable: true},
                {field: 'fromName', title: '来话人', align: 'center', sortable: true},
                {field: 'fromTime', title: '接听时间', align: 'center', sortable: true},
                {
                    field: 'xinputTime', title: '办结日期', align: 'center',
                    formatter:function (value,row,index) {
                        return resultFormatter(value);
                    }
                },
                {
                    field: 'stateFlag', title: '标记', hidden: true,
                    formatter: function (value, row, index) {
                        return fmtTelGetState(value, row, index);
                    }
                },
                {field: 'xsysDesc', title: '坐席备注', align: 'left', halign: 'center'},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.pkId + '\')"><i class="fa fa-edit"></i>处理</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.pkId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function resultFormatter(cellval) {
        if (cellval) {
            var date = new Date(cellval);
            var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
            var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
            return date.getFullYear() + "-" + month + "-" + currentDate;
        }
        return "";
    }
</script>
</body>
</html>